import { ConfigService } from '@nestjs/config';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './modules/main/app.module';
import middlewaresConfig from './middlewares/middleware.config';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  middlewaresConfig(app);

  const configService = app.get(ConfigService);
  const appPort = configService.get<string>('PORT') || 3000;

  await app.listen(appPort, () => {
    console.log(`🚀 http://localhost:${appPort}`);
  });
}

bootstrap();
